package com.longge;

import java.util.Arrays;

public class NumArray {

    int[] preNum;

    public NumArray(int[] nums) {
        preNum = new int[nums.length + 1];
        for (int i = 1; i < preNum.length; i++) {
            preNum[i] = preNum[i - 1] + nums[i - 1];
        }
    }

    public int sumRange(int left, int right) {
        return preNum[right + 1] - preNum[left];
    }

    public static void main(String[] args) {
        String a = "a/a/b/";
        String[] split = a.split("/");
        System.out.println(Arrays.toString(split));
    }
}
